Skip to content

TUI: clip inline terminal block painting - #14594

Merged
harryalbert merged 2 commits into
masterfrom
harry/tui-lrc-within-agent-block-fix
Jul 31, 2026
Merged

TUI: clip inline terminal block painting#14594
harryalbert merged 2 commits into
masterfrom
harry/tui-lrc-within-agent-block-fix

Conversation

@harryalbert

@harryalbert harryalbert commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Description

Adds a targeted follow-up for expanded shell commands rendered inside Warp Agent CLI blocks. Top-level terminal blocks already receive a viewport-clipped row range, but inline TerminalBlockRows::Content previously walked every retained command/output row and column on each paint while the nested paint surface discarded offscreen writes.

This change exposes the element-local visible row window from TuiPaintSurface, intersects terminal block painting with that window, and translates the source-row and cursor origins before rendering. Inline command paint work is now proportional to the visible viewport rather than total retained output; the same intersection applies defensively to already-preclipped top-level terminal blocks. Regression coverage verifies nested clip coordinates and exact inline terminal row-window rendering.

Benchmark at 120×50 with a fixed 50-row viewport versus stack PR 3:

  • Expanded inline terminal content, 100 retained rows: 61.6 → 30.9 µs/frame (50% faster, 2.0×).
  • Expanded inline terminal content, 1,000 retained rows: 123.8 → 36.1 µs/frame (71% faster, 3.4×).
  • Baseline paint cost doubles from 100 to 1,000 retained rows; the clipped implementation remains close to the fixed viewport cost.

Agent conversation: https://staging.warp.dev/conversation/963ead54-9843-4cc1-8d8b-dbf695ee7046

Linked Issue

N/A — Warp Agent CLI transcript rendering performance.

Testing

  • cargo nextest run -p warpui_core --features tui -E 'test(visible_rows_are_relative_to_the_element_origin) | test(widget_renders_only_visible_rows) | test(nested_surface_clip_contains_cells_styles_and_widgets)' — 3 passed.

  • cargo nextest run -p warp_tui -E 'test(terminal_block::tests)' — 10 passed.

  • cargo bench -p warp_tui --features test-util --bench transcript_bench -- 'tui_terminal_block/clipped_content'

  • ./script/format

  • I have manually tested my changes locally with ./script/run-tui

Agent Mode

  • Warp Agent Mode - This PR was created via Warp's AI Agent Mode

CHANGELOG-NONE

Co-Authored-By: Oz oz-agent@warp.dev

harryalbert commented Jul 31, 2026

Copy link
Copy Markdown
Contributor Author

@oz-for-oss

oz-for-oss Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

@harryalbert

I'm starting a first review of this pull request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@oz-for-oss oz-for-oss Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overview

This PR optimizes TUI inline terminal block painting by exposing a visible row window from TuiPaintSurface, clipping terminal block rendering to that window, and adding targeted regression coverage plus a benchmark.

Concerns

  • ⚠️ [IMPORTANT] This is a user-facing TUI rendering/performance change, but the PR description only lists automated tests and a benchmark. Repo review guidance requires acceptable TUI visual evidence for user-visible changes: a terminal transcript, a render_to_lines / TuiBuffer::to_lines snapshot diff, or a ./script/run-tui capture. Please attach one of those demonstrating inline terminal block rendering end to end.

Verdict

Found: 0 critical, 1 important, 0 suggestions

Request changes

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Base automatically changed from oz/tui-retained-frame-overhead to master July 31, 2026 17:15
harryalbert and others added 2 commits July 31, 2026 13:27
@harryalbert
harryalbert force-pushed the harry/tui-lrc-within-agent-block-fix branch from b621986 to c7ed842 Compare July 31, 2026 17:27
@harryalbert
harryalbert enabled auto-merge (squash) July 31, 2026 17:43
@harryalbert
harryalbert merged commit a95e6e5 into master Jul 31, 2026
27 checks passed
@harryalbert
harryalbert deleted the harry/tui-lrc-within-agent-block-fix branch July 31, 2026 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants